<template>
    <ul>
        <li v-for="item in goodsList" :key="item.id" @click="goToDetail(item.id)">
            <img v-lazy="item.list_pic_url" alt="" width="100%">   
            <div class="van-ellipsis">{{item.name}}</div>  
            <div class="price">{{ item.retail_price | RMBFormat}}</div>
        </li> 
       
        
    </ul>
</template>

<script>
export default {
    props:["goodsList"],
    created(){
        // console.log("this.goodsList为：",this.goodsList);
    },
    data () {
        return {
            imgSrc:require("@/assets/logo.png")
 
        }
    },
    methods:{
        goToDetail(val){
            // console.log("跳转到详情页面");

            this.$router.push("/productDetail?id="+val);

            setTimeout(()=>{
                this.$router.go(0)
            },10)
            
        }
    }
}
</script>
 
<style lang = "less" scoped>
   ul{
       padding: .1rem 1%;
       display: flex;
       flex-wrap: wrap;
       background-color: #fff;
       li{
           width: 49%;
           padding-left: .1rem;
           padding-right: .1rem;
           box-sizing: border-box;
           text-align: center;
           .price{
               line-height:.3rem;
               color:darkred;
           }
       }
   } 
</style>